package cn.wolfcode.wms.controller;

import cn.wolfcode.wms.qo.ProductStockQueryObject;
import cn.wolfcode.wms.service.IBrandService;
import cn.wolfcode.wms.service.IDepotService;
import cn.wolfcode.wms.service.IProductStockService;
import cn.wolfcode.wms.util.RequiredPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
@RequestMapping("/productStock")
public class ProductStockController {
    @Autowired
    private IProductStockService productStockService;
    @Autowired
    private IBrandService brandService;
    @Autowired
    private IDepotService depotService;

    @RequestMapping("/list")
    @RequiredPermission("即时库存列表")
    public String list(@ModelAttribute("qo") ProductStockQueryObject qo, Map map) {
        map.put("pageResult", productStockService.query(qo));
        map.put("depots", depotService.listAll());
        map.put("brands", brandService.listAll());

        return "productStock/list";
    }
}
